package and2.ex;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;

import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.reflect.TypeToken;

import and2.ex.api.request.WebReq;
import and2.ex.bean.Topic;
import android.app.Activity;
import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TabHost;

public class HomeActivity extends Activity {
	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		try {
//			List<Topic> topics = new ArrayList<Topic>();
			Type collectionType = new TypeToken<List<Topic>>(){}.getType();
			List<Topic> topics = new WebReq.Builder().setEndPoint("http://www.v2ex.com").req("/api/topics/latest.json",collectionType);
			Log.d("dd",""+topics.size());
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}